Repository navigation
Conversation
Require a dedicated preview hostname and explicit studio frame origins. Keep platform routes off the preview host and reject studio backends. Cover authenticated browser isolation, module loading and SPA navigation.
|
LoopForge PR Review — commit Result: Verification blocked Verified in this round (isolated, credential-free sandbox):
Not verifiable this round:
To close this out: (a) a maintainer approves/triggers the CI run for this SHA so @AlexXPZhu could you, or a maintainer with approval rights, approve the pending workflow run for this commit so CI actually executes? I can't confirm who holds approval rights on this repo — please route to whoever does if that's not you. Automated review by LoopForge PR bot. |
Share the validated preview origin with studio security headers and keep session URLs unchanged in the UI. Exercise the parent through the production middleware, cover invalid configurations and other page policies, and verify preview refresh and backend changes.
|
@crispinhu27 你好,想麻烦你看一下这个 PR。 fx-kurumi 上一轮提的工作台 另外 如果 CI 里 谢谢! |
|
复查当前 head [P1] FRAME_ANCESTORS 无效时,预览域名的平台路由封锁会失效位置:
复现配置: AGENTFLOW_PREVIEW_PUBLIC_URL=https://preview.example.test
AGENTFLOW_PREVIEW_FRAME_ANCESTORS=https://studio.example.test先使用上述完整配置,再将第二项清空或改为
另用 这使一次嵌入配置遗漏同时打开了预览域名的平台路由;已有预览文档在服务重启后仍可能继续运行,配置了后端的预览 CSP 也允许连接 [P2] 会话校验失败后,ZIP 下载和后端修正入口同时消失位置: 两个升级场景均可复现:
建议保留 验证: |
…ession errors Reserve the configured preview hostname from AGENTFLOW_PREVIEW_PUBLIC_URL alone. A missing or invalid AGENTFLOW_PREVIEW_FRAME_ANCESTORS now only disables sessions and the studio frame-src allowance; studio pages and APIs keep returning 404 on the preview hostname, and the gateway serves sessions only with a complete isolation configuration. A hostname listed in FRAME_ANCESTORS or used by AGENTFLOW_PUBLIC_URL is a studio and is never reserved: earlier docs described the preview URL as the studio's own origin, and reserving it would take that studio offline. While isolation is incomplete, the reserved host's 404 explains the configuration and startup logs a warning. Compose forwards AGENTFLOW_PUBLIC_URL. Session and backend errors carry stable codes (preview_isolation_required, preview_backend_on_studio). Clearing a stored backend is always allowed, and a saved backend without a following session reports sessionError. The run preview tab keeps the ready archive when only the session fails: ZIP download, backend change/clear and refresh stay available with a specific explanation. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
@crispinhu27 @fx-kurumi 感谢复现,两条问题已在 [P1] 预览域名的保留与 FRAME_ANCESTORS 解耦
[P2] 会话失败不再清掉归档入口
测试新增的回归测试先在未修改的
本地全量验证(Go 1.26.11,修复后的分支,另在与最新
未跑:MySQL 版 Playwright、Firefox/WebKit、真实 DNS/TLS 反代部署。 |
|
LoopForge PR Review — head Verdict: ❌ Not pass — @AlexXPZhu
Blocking: rebase/merge |
Yanami-2K
left a comment
There was a problem hiding this comment.
整体方向与 #93 的验收项一致:预览改为独立 hostname(internal/preview/origin.go 的 isolatedOrigins/reservedOrigin),预览域名上的平台路由一律 404(internal/httpapi/run_preview.go previewHost()),后端地址禁止指向工作台 hostname 且在 gateway.go ServeHTTP 中对已存会话重新校验,预览 CSP 收紧为 default-src 'none' 并补了真实 Chromium 回归 TestPreviewIsolationBrowser,CI 全绿。但目前还不能合入:
- 与 main 冲突(mergeableState=dirty):请先 rebase 到最新 main 并解决冲突。本 PR 改了
internal/httpapi/server.go(securityHeaders(e.Preview()))、internal/httpapi/gin_helpers.go(securityHeaders签名)、web/app/runs.js等高频改动文件,rebase 后请确认securityHeaders的所有调用点都已传入 preview service,并重跑TestPreviewStudioCSP、TestPreviewIsolationBrowser、TestPreviewAPIAndPathGateway。 internal/httpapi/server.go中securityHeaders(e.Preview())在构建路由时只取一次PublicOrigin():如果 preview service 在New(...)之后才通过SetPreview挂上(或以后支持热更新配置),工作台根页面的frame-src不会包含预览 origin,iframe 会被 CSP 拦掉。请在 rebase 时确认cmd/agentflow/main.go中attachPreviewStore一定先于httpapi.New执行,或者改为在中间件里每次请求读取e.Preview().PublicOrigin(),并加一个顺序相关的测试。
说明:docs/deployment.md、internal/preview/gateway.go、run_preview.go、几个新测试文件的 patch 被截断,internal/preview/service.go、web/app/runs.js、web/preview_session_test.js、web/syntax_test.go、webtest/tests/runs-actions.test.mjs 未返回 patch,这些文件我只能结合 PR 描述判断,没有逐行看全。另外这是对已有部署的破坏性变更(不配 AGENTFLOW_PREVIEW_FRAME_ANCESTORS 就无法在线预览),已在描述和文档中写明,合入前建议维护者确认发布说明里有醒目提示。
Keep both browser tests registered for the Chromium step: the sharp-frame capture test from main and the preview isolation test from this branch. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
LoopForge PR Review — head Verdict: ✅ Pass
No blocking issues found on this head. |
securityHeaders captured e.Preview().PublicOrigin() once when New built the routes, so a preview service attached via Engine.SetPreview after New never made it into the studio page's frame-src and the preview iframe was blocked by the platform's own CSP. Pass e.Preview as a func and read the origin on each studio request, and add a regression test that attaches the preview service after New. Addresses review item 2 from Yanami-2K on Tencent#187. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
LoopForge PR Review — head Verdict: ✅ Pass
No blocking issues found on this head. LoopForge PR Review bot · hourly sweep |
|
@Yanami-2K @crispinhu27 麻烦复查一下当前 head
CI 16 项在当前 head 上全部通过。没有问题的话,麻烦撤销 Request changes / approve,谢谢! |
Preserve the current main translation dictionary and all eight preview isolation messages when resolving web/i18n-en.js. Validated preview package, focused HTTP API/CSP regressions, real Chromium preview isolation, full web package, 206 webtest cases, chatbot build, go vet, public-content checks, and secret scan.
What changed
Fixes #93.
An archived preview could share the studio origin and use
parent.fetchwith the viewer's signed-in session. Previews now require a dedicated hostname and explicit studio frame origins.frame-src, using the same service configuration as the gateway. Keep chatbot/VS Code policies unchanged. Use server-issued preview URLs unchanged for embedding, copying and opening a standalone window.Scope
Compatibility
Deployment configuration is required to reopen online previews:
The second value accepts space-separated exact studio origins. Route both hostnames to the platform while preserving Host; deployment docs include proxy and local-development examples. Until configured, session creation returns an explicit error. Archiving and the authenticated ZIP download API remain available. Existing studio-origin preview links return 404.
Configure an HTTPS preview URL when the studio uses HTTPS; the client no longer probes or rewrites the URL.
Bundle external scripts/styles/fonts locally. Nested frames and workers/service workers are blocked. Configured non-studio backends still need their own CORS support. Preview producers share the dedicated preview origin; this change does not provide isolation between previews.
No SQL migration, schema change or runner protocol change. Classic and Portable are unchanged.
Validation
Passed locally for the updated tree:
bash scripts/build-chatbot.sh: 299 tests and production build.npm --prefix webtest test: 164 tests.go test -p=2 ./... -count=1 -timeout=180s -skip "$REAL_BROWSER_TESTS", with the five-test pattern from.github/workflows/platform.yml.-p=1ininternal/httpapi,internal/runnerandinternal/runtime.go vet ./...,python3 scripts/check-public.py,bash scripts/scan-secrets.sh, and staged diff checks.The initial non-browser command included global Git environment overrides, which interfered with test fixtures and helper builds. After removing those overrides, the engine/runtime/runner package suites passed on rerun; all other packages had passed in the full run. Go 1.26.11 and local Chromium with its system libraries were used.
Negative control for this review: registering the browser test parent on the production router while retaining the pre-fix production code (
81c53b7) fails withparent CSP blocked frame-src. The updated code passes with and without a configured backend, embedded and standalone, while parent access and studio API/image requests remain blocked.Not run: the full MySQL-backed public Playwright suite, Firefox/WebKit, or a live DNS/TLS proxy deployment. Local-edition checks are not applicable.
Safety
Prepared with Codex assistance.